package com.ssy.lingxi.purchase.api.enums.onlinebidding;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 在线竞价单- 供应商竞价报名外部审核状态枚举
 * @author lxc
 * @date 2022/3/15
 */
public enum OnlineAudteExternalStateEnum {
    STAY_EXAMINE_SIGNUP_BIDDING(1, "待审核竞价报名"),
    SIGNUP_BIDDING_NOT(2, "竞价报名审核不通过"),
    SIGNUP_BIDDING_PASS(3, "竞价报名审核通过"),
    ;

    private Integer state;
    private String name;

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }

    OnlineAudteExternalStateEnum(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public static String getName(Integer state){
        OnlineAudteExternalStateEnum workEnum = Arrays.stream(OnlineAudteExternalStateEnum.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(OnlineAudteExternalStateEnum.class, workEnum.getState());
    }

    /**
     * 获取枚举列表
     * @return
     */
    public static List<Integer> getCodes(){
        return Arrays.stream(OnlineAudteExternalStateEnum.values()).map(OnlineAudteExternalStateEnum::getState).collect(Collectors.toList());
    }
}
